/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import * as path from 'path';
import { spawn } from 'child_process';

describe('test hvigorfileTypeCheck', () => {
  test('test hvigorfileTypeCheck', () => {
    const testFile = path.resolve(__dirname, './test-hvigorfile-type-check.js',);
    const testApp = spawn('node', [testFile]);
    testApp.stdout.on('data', data => {
      const res = data.toString();
      expect(res).toContain('y: number = f()');
      expect(res).toContain('import { f } from \'./d\'');
      expect(res).toContain('const z = x.length');
      expect(res).toContain('export const x: number = \'1\'');
      testApp.kill('SIGINT');
    });
  });
});